//
// Device.hpp for Device in /home/mambou_j//babel-2014
// 
// Made by jacquesquentin mamboumouafo
// Login   <mambou_j@epitech.net>
// 
// Started on  Fri May 11 02:09:33 2012 jacquesquentin mamboumouafo
// Last update Tue May 15 15:57:23 2012 jacquesquentin mamboumouafo
//


#ifndef	__DEVICE_HPP__
#define	__DEVICE_HPP__

#include	"portaudio.h"
#include	"Device.hpp"

// Forward declaration(s):
namespace	portaudio
{
  class	System;
  class	HostApi;
}

// Declaration(s):
namespace	portaudio
{

  /////
  /// @brief Class which represents a PortAudio device in the System.
  ///
  /// A single physical device in the system may have multiple PortAudio
  /// Device representation using different HostApi's though. A Device can
  /// be used to create a half-duplex Stream. A full-duplex Device can be used
  /// to create a full-duplex Stream. If supported by the HostApi, two
  /// half-duplex Devices can even be used to create a full-duplex Stream.
  ///
  /// Note that Device objects are very light-weight and can be passed around
  /// by-value.
  //////
	class	Device
	{
	public:
	  // query info: name, max in channels, max out channels,
	  // default low/hight input/output latency, default sample rate
	  PaDeviceIndex	index() const;
	  const	char	*name() const;
	  int	maxInputChannels() const;
	  int	maxOutputChannels() const;
	  PaTime	defaultLowInputLatency() const;
	  PaTime	defaultHighInputLatency() const;
	  PaTime	defaultLowOutputLatency() const;
	  PaTime	defaultHighOutputLatency() const;
	  double	defaultSampleRate() const;

	  bool	isInputOnlyDevice() const;
	  bool	isOutputOnlyDevice() const;
	  bool	IsFullDuplexDevice() const;
	  bool	isSystemDefaultInputDevice() const;
	  bool	isSystemDefaultOutputDevice() const;
	  bool	isHostApiDefaultInputDevice() const;
	  bool	isHostApiDefaultOutputDevice() const;

	  bool	operator==(const Device &rhs);
	  bool	operator!=(const Device &rhs);

	  // host Api reference
	  HostApi	&hostApi();
	  const	HostApi	&hostApi() const;

	private:
	  PaDeviceIndex	index_;
	  const	PaDeviceInfo *info_;

	private:
	  friend	class	System;

	  explicit	Device(PaDeviceIndex index);
	  ~Device();

	  Device(const Device &);
	  Device	&operator=(const Device &);
	};
}

#endif
